package jmu.cyxwcy.librarymanagement.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import jmu.cyxwcy.librarymanagement.pojo.Admin;
import jmu.cyxwcy.librarymanagement.pojo.Book;
import jmu.cyxwcy.librarymanagement.pojo.Teachers;
import jmu.cyxwcy.librarymanagement.mapper.TeachersMapper;
import jmu.cyxwcy.librarymanagement.service.ITeachersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2024-06-25
 */
@Service
public class TeachersServiceImpl extends ServiceImpl<TeachersMapper, Teachers> implements ITeachersService {

    @Autowired
    private TeachersMapper teachersMapper;
    @Override
    public Teachers findByUserName(String username) {
        Teachers teacher= teachersMapper.findByUserName(username);
        return teacher;
    }

    @Override
    public IPage<Teachers> join(IPage<Teachers> page, MPJLambdaWrapper<Teachers> queryWrapper) {
        return teachersMapper.selectJoinPage(page, Teachers.class, queryWrapper);
    }

    @Override
    public Teachers joinInfo(MPJLambdaWrapper<Teachers> queryWrapper) {
        return teachersMapper.selectOne(queryWrapper);
    }

    @Override
    public void resetPassword(Integer teacherId, String md5String) {
        teachersMapper.resetPassword(teacherId,md5String);
    }

}
